package com.fxp.project.jiuselu.web.models.sample.service.impl;

import com.fxp.project.jiuselu.commons.utils.DateUtils;
import com.fxp.project.jiuselu.web.models.sample.entity.SapmleGoods;
import com.fxp.project.jiuselu.web.models.sample.mapper.SapmleGoodsMapper;
import com.fxp.project.jiuselu.web.models.sample.service.ISapmleGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 样品订单明细Service业务层处理
 *
 * @author Jason.Wang
 * @date 2022-06-08
 */
@Service
public class SapmleGoodsServiceImpl implements ISapmleGoodsService
{
    @Autowired
    private SapmleGoodsMapper sapmleGoodsMapper;

    /**
     * 查询样品订单明细
     *
     * @param sampleId 样品订单明细主键
     * @return 样品订单明细
     */
    @Override
    public SapmleGoods selectSapmleGoodsBySampleId(String sampleId)
    {
        return sapmleGoodsMapper.selectSapmleGoodsBySampleId(sampleId);
    }

    /**
     * 查询样品订单明细列表
     *
     * @param sapmleGoods 样品订单明细
     * @return 样品订单明细
     */
    @Override
    public List<SapmleGoods> selectSapmleGoodsList(SapmleGoods sapmleGoods)
    {
        return sapmleGoodsMapper.selectSapmleGoodsList(sapmleGoods);
    }

    /**
     * 新增样品订单明细
     *
     * @param sapmleGoods 样品订单明细
     * @return 结果
     */
    @Override
    public int insertSapmleGoods(SapmleGoods sapmleGoods)
    {
        sapmleGoods.setCreateTime(DateUtils.getNowDate());
        return sapmleGoodsMapper.insertSapmleGoods(sapmleGoods);
    }

    /**
     * 修改样品订单明细
     *
     * @param sapmleGoods 样品订单明细
     * @return 结果
     */
    @Override
    public int updateSapmleGoods(SapmleGoods sapmleGoods)
    {
        return sapmleGoodsMapper.updateSapmleGoods(sapmleGoods);
    }

    /**
     * 批量删除样品订单明细
     *
     * @param sampleIds 需要删除的样品订单明细主键
     * @return 结果
     */
    @Override
    public int deleteSapmleGoodsBySampleIds(String[] sampleIds)
    {
        return sapmleGoodsMapper.deleteSapmleGoodsBySampleIds(sampleIds);
    }

    /**
     * 删除样品订单明细信息
     *
     * @param sampleId 样品订单明细主键
     * @return 结果
     */
    @Override
    public int deleteSapmleGoodsBySampleId(String sampleId)
    {
        return sapmleGoodsMapper.deleteSapmleGoodsBySampleId(sampleId);
    }
}
